package dongtaiguihua;

public class twoEggs {

    public static void main(String[] args) {
        int n = 20;
        twoEggDrop(n);
    }

    private static final int[] memo = new int[1001];
    public static int twoEggDrop(int n) {
        if(n == 0){
            return 0;
        }
        if(memo[n] > 0){
            return memo[n];
        }
        int ans = Integer.MAX_VALUE;
        for(int j=1 ; j<=n ;j++){
            ans = Math.min(ans,Math.max(j,twoEggDrop(n-j)+1));
        }
        return memo[n] = ans;
    }
}
